package cn.iocoder.yudao.module.custom.dal.mysql.city;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.custom.dal.dataobject.city.CityDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.custom.controller.admin.city.vo.*;

/**
 * 城市信息 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface CityMapper extends BaseMapperX<CityDO> {

    default PageResult<CityDO> selectPage(CityPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CityDO>()
                .likeIfPresent(CityDO::getName, reqVO.getName())
                .eqIfPresent(CityDO::getParentId, reqVO.getParentId())
                .orderByDesc(CityDO::getId));
    }

    default List<CityDO> selectList(CityExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<CityDO>()
                .likeIfPresent(CityDO::getName, reqVO.getName())
                .eqIfPresent(CityDO::getParentId, reqVO.getParentId())
                .orderByDesc(CityDO::getId));
    }


    List<CityDO> getCityLists(Integer parentId);
}
